<?php
/**
 * @var \Phalcon\Mvc\View\Engine\Php $this
 */
?>

<?php use Phalcon\Tag; ?>
<div class="row">
    <nav>
        <ul class="pager">
            <li class="next"><?= $this->tag->linkTo(["user/register/", "class" => "btn btn-info", "添加",]); ?></li>
        </ul>
    </nav>
</div>
<div class="page-header">
    <h1>用户列表</h1>
</div>
<?php echo $this->getContent(); ?>
<div class="row">
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>用户id</th>
            <th>用户名</th>
            <th>密码</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach($page->items as $admin): ?>
            <tr>
                <td><?php echo $admin->id ?></td>
                <td><?php echo $admin->username ?></td>
                <td><?php echo $admin->password ?></td>
                <td><?php echo $this->tag->linkTo(["user/edit/" . $admin->id, "class" => "btn btn-info", "编辑",]) ?></td>
                <td><?php echo $this->tag->linkTo(["user/delete/" . $admin->id, "class" => "btn btn-danger", 'id'=>'del-'.$admin->id,"删除"]); ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>
<div class="row">
    <div class="col-sm-1">
        <p class="pagination" style="line-height: 1.42857;padding: 6px 12px;">
            <?php echo $page->current, "/", $page->total_pages ?>
        </p>
    </div>
    <div class="col-sm-11">
        <nav>
            <ul class="pagination">
                <li><?php echo $this->tag->linkTo("user/index", "首页") ?></li>
                <li><?php echo $this->tag->linkTo("user/index?page=" . $page->before, "上一页") ?></li>
                <li><?php echo $this->tag->linkTo("user/index?page=" . $page->next, "下一页") ?></li>
                <li><?php echo $this->tag->linkTo("user/index?page=" . $page->last, "末页") ?></li>
            </ul>
        </nav>
    </div>
</div>
